package com.boho.system.action;


             
/**
 * @File name:  QueryTSysFunctionAction.java 
 * @Create on:  2010-05-10 19:30:171
 * @Author   :  陈伟
 *
 * @ChangeList
 * ---------------------------------------------------
 * Date         Editor              ChangeReasons
 *
 */
           
        

            
import java.util.List;

import cn.boho.framework.actions.ActionImp;
import cn.boho.framework.context.ActionContext;
import cn.boho.framework.service.MessageService;

import com.boho.base.dao.DaoHelper;
import com.boho.system.service.PermissionService;

public class QueryUserDepartAction extends ActionImp {
	
	private Integer userid;
	@Override
	protected void doException(ActionContext atx, Exception ex) {
		atx.setErrorContext("BOHO_COMMON_1004", MessageService.getMessage("BOHO_COMMON_1004"),"【用户管理组织】" ,ex);
	}
	@SuppressWarnings("unchecked")
	@Override
	protected int performExecute(ActionContext atx) throws Exception {
		List list= PermissionService.queryUserDepartmentById(atx, userid);
		DaoHelper.setTDepartmentField(atx.getConection(), list, "_NAME", "DEPARTMENT_NO");
		atx.setValue("T_USER_DEPARTMENT", list.toArray());
		return 1;
	}
	@Override
	protected int verifyParameters(ActionContext atx) throws Exception {
		userid = atx.getIntegerValue("USER_ID");
		return 1;
	}
}
